<template>
  <!-- 水印 -->
  <edit-watermark></edit-watermark>
  <suspense>
    <suspense-index></suspense-index>
  </suspense>
</template>

<script setup lang="ts">
import suspenseIndex from './suspenseIndex.vue'
import {EditWatermark} from "@/views/chart/ContentEdit/components/EditWatermark/index";
import {getSessionStorageInfo} from '../preview/utils'
import {useRoute} from 'vue-router';
// @ts-ignore
import Utils from "@/vue2-flow/src/utils/Common.js";
// @ts-ignore
import UserPageApi from "@/api/flow/UserPageApi.js";
import {MessageError, setSessionStorage} from "@/utils";
import {StorageEnum} from "@/enums/storageEnum";

const route = useRoute();
const id = route.params.id[0]
const config = getSessionStorageInfo(id)
const isLoad = sessionStorage.getItem('isLoadPreviewConfig')
if (Utils.IsEmpty(isLoad) && id && Utils.IsEmpty(config)) {
  new UserPageApi().GetUserPageProjectById(id, (res: any) => {
    if (Utils.IsEmpty(res)) {
      MessageError('项目异常，可能被删除或为保存');
      return
    }
    res.Id = id
    setSessionStorage(StorageEnum.GO_CHART_STORAGE_LIST, res)
    sessionStorage.setItem('isLoadPreviewConfig', '1')
    location.reload()
  })
}
</script>
